<?php

namespace App\Admin\Actions\Grid;

use App\Models\InvitationApply;
use Dcat\Admin\Actions\Response;
use Dcat\Admin\Admin;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Dcat\Admin\Widgets\Modal;
use Dcat\Admin\Widgets\Table;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;

class ViewAuditComments extends RowAction
{
    protected $title = '<i class="feather icon-eye text-custom"></i> <span class="text-custom" title="">查看意见</span> &emsp;';

    public function render()
    {
        // 实例化表单类并传递自定义参数
        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body($this->table(['id' => $this->getKey()]))
            ->button($this->title);
    }

    protected function table($input)
    {

        $apply = InvitationApply::where('id', $input['id'])->first();

        Admin::style('.table td{padding: .85rem .55rem}');
        $data = [
            ['name' => '审核意见：',       'value' => $apply->audit_desc],
            ['name' => '审核时间：',       'value' => $apply->audit_time],

        ];
        return Table::make([], $data);
    }
}
